using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections.Generic; using System.Data; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers { /** * 找货单单 */ public class Sc_MouldRepairInBillListController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更) private json objJsonResult = new json(); public DataSet ds = new DataSet(); public WebServer webserver = new WebServer(); public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类 public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类 /// /// 根据包装单 返回此包装单内的相关信息 /// /// /// /// 检具维修工单列表 /// /// [Route("Sc_CheckToolsRepair/GetCheckToolsRepairWorkBillList")] [HttpGet] public object GetCheckToolsRepairWorkBillList(string sWhere) { try { ds = Sc_CheckToolsRepairWorkBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsRepairWorkBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsRepairWorkBillList ", "h_v_Sc_CheckToolsRepairWorkBillList"); } /// /// 检具点检计划表列表 /// /// [Route("Sc_CheckToolsDotCheckPlan/GetCheckToolsDotCheckPlanBillList")] [HttpGet] public object GetCheckToolsDotCheckPlanBillList(string sWhere) { try { ds = Sc_CheckToolsDotCheckPlanBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsDotCheckPlanBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsDotCheckPlanBillList ", "h_v_Sc_CheckToolsDotCheckPlanBillList"); } #endregion /// /// 检具保养记录表列表 /// /// [Route("Sc_CheckToolsMaintainBill/GetCheckToolsMaintainBillList")] [HttpGet] public object GetCheckToolsMaintainBillList(string sWhere) { try { ds = Sc_CheckToolsMaintainBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsMaintainBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsMaintainBillList ", "h_v_Sc_CheckToolsMaintainBillList"); } #endregion /// /// 模具保养记录表列表 /// /// [Route("Sc_MouldMaintainBill/GetMouldMaintainBillList")] [HttpGet] public object GetMouldMaintainBillList(string sWhere) { try { ds = Sc_MouldMaintainBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldMaintainBillList_s(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintain order by 日期 desc", "h_v_Sc_MouldMaintain"); } else { string sql1 = "select * from h_v_Sc_MouldMaintain where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldMaintain"); } //return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintainBillList ", "h_v_Sc_MouldMaintainBillList"); } #endregion /// /// 模具点检计划表列表 /// /// [Route("Sc_MouldDotCheckPlanBill/GetMouldDotCheckPlanBillList")] [HttpGet] public object GetMouldDotCheckPlanBillList(string sWhere) { try { ds = Sc_MouldDotCheckPlanBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldDotCheckPlanBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldDotCheckPlanBillList ", "h_v_Sc_MouldDotCheckPlanBillList"); } #endregion /// /// 模具点检记录表列表 /// /// [Route("Sc_MouldDotCheckBill/GetMouldDotCheckBillList")] [HttpGet] public object GetMouldDotCheckBillList(string sWhere) { try { ds = Sc_MouldDotCheckBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldDotCheckBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldDotCheckBillList where 1=1 "+sWhere+" ", "h_v_Sc_MouldDotCheckBillList"); } #endregion /// /// 检具保养计划表列表 /// /// [Route("Sc_CheckToolsMaintainPlanBill/GetCheckToolsMaintainPlanBillList")] [HttpGet] public object GetCheckToolsMaintainPlanBillList(string sWhere) { try { ds = Sc_CheckToolsMaintainPlanBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsMaintainPlanBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsMaintainPlanBillList ", "h_v_Sc_CheckToolsMaintainPlanBillList"); } #endregion /// /// 模具保养计划表列表 /// /// [Route("Sc_MouldMaintainPlanBill/GetMouldMaintainPlanBillList")] [HttpGet] public object GetMouldMaintainPlanBillList(string sWhere) { try { ds = Sc_MouldMaintainPlanBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldMaintainPlanBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintainPlanBillList ", "h_v_Sc_MouldMaintainPlanBillList"); } #endregion /// /// 模具故障登记表列表 /// /// [Route("Sc_MouldConkBookBill/GetMouldConkBookBillList")] [HttpGet] public object GetMouldConkBookBillList(string sWhere) { try { ds = Sc_MouldConkBookBillList_s(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldConkBookBillList_s(string sWhere) { DataSet ds; if (sWhere == null || sWhere.Equals("")) { ds = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldConkBookBillList order by 日期 desc" + sWhere, "h_v_Sc_MouldConkBookBillList"); } else { string sql1 = "select * from h_v_Sc_MouldConkBookBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; ds = new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldConkBookBillList"); } return ds; } #endregion /// /// 模具维修验收单列表 /// /// [Route("Sc_MouldRepairCheckBill/GetMouldRepairCheckBillList")] [HttpGet] public object GetMouldRepairCheckBillList(string sWhere) { try { ds = Sc_MouldRepairCheckBillList_s(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldRepairCheckBillList_s(string sWhere) { DataSet ds; if (sWhere == null || sWhere.Equals("")) { ds = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldRepairCheckBillList_Edit order by 日期 desc" + sWhere, "h_v_Sc_MouldRepairCheckBillList_Edit"); } else { string sql1 = "select * from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; ds = new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit"); } return ds; } #endregion /// /// 检具维修验收单列表 /// /// [Route("Sc_CheckToolsRepairCheckBill/GetCheckToolsRepairCheckBillList")] [HttpGet] public object GetCheckToolsRepairCheckBillList(string sWhere) { try { ds = Sc_CheckToolsRepairCheckBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsRepairCheckBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsRepairCheckBillList ", "h_v_Sc_CheckToolsRepairCheckBillList"); } #endregion #region sql语句 //public static DataSet Sc_MouldRepairCheckBillList_s(string sWhere) //{ // return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldRepairCheckBillList ", "h_v_Sc_MouldRepairCheckBillList"); //} #endregion /// /// 模具维修工单表列表 /// /// [Route("Sb_MouldRepairWorkBill/GetMouldRepairWorkBillList")] [HttpGet] public object GetMouldRepairWorkBillList(string sWhere) { try { ds = Sc_MouldRepairWorkBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_MouldRepairWorkBillList_s(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldRepairWorkBillList order by 日期 desc" + sWhere, "h_v_Sc_MouldRepairWorkBillList"); } else { string sql1 = "select * from h_v_Sc_MouldRepairWorkBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList"); } } #endregion /// /// 检具故障登记表列表 /// /// [Route("Sc_CheckToolsConkBookBill/GetCheckToolsConkBookBillList")] [HttpGet] public object GetCheckToolsConkBookBillList(string sWhere) { try { ds = Sc_CheckToolsConkBookBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsConkBookBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsConkBookBillList ", "h_v_Sc_CheckToolsConkBookBillList"); } #endregion /// /// 检具点检记录表列表 /// /// [Route("Sc_CheckToolsDotCheckBill/GetCheckToolsDotCheckBillList")] [HttpGet] public object GetCheckToolsDotCheckBillList(string sWhere) { try { ds = Sc_CheckToolsDotCheckBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_CheckToolsDotCheckBillList_s(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsDotCheckBillList ", "h_v_Sc_CheckToolsDotCheckBillList"); } #endregion /// /// 调拨单列表 /// /// [Route("Kf_MoveStockBill/GetMoveStockBillList")] [HttpGet] public object GetMoveStockBillList(string sWhere) { try { ds = Sc_GetMoveStockBillList(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetMoveStockBillList(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MoveStockBillList ", "h_v_IF_MoveStockBillList"); } #endregion /// /// 生产领料单列表 /// /// [Route("Kf_MateOutBill/GetMateOutBillList")] [HttpGet] public object GetMateOutBillList(string sWhere) { try { ds = Sc_GetMateOutBillList(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetMateOutBillList(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MateOutBillList ", "h_v_IF_MateOutBillList"); } #endregion /// /// 销售出库单列表 /// /// [Route("Kf_SellOutBill/GetSellOutBillList")] [HttpGet] public object GetSellOutBillList(string sWhere) { try { ds = Sc_GetSellOutBillList(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetSellOutBillList(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList ", "h_v_IF_SellOutBillList"); } #endregion /// /// 其他出库单列表 /// /// [Route("Kf_OtherOutBill/GetOtherOutBillList")] [HttpGet] public object GetOtherOutBillList(string sWhere) { try { ds = Sc_GetOtherOutBillList(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetOtherOutBillList(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Kf_OtherOutBillList ", "h_v_Kf_OtherOutBillList"); } #endregion /// /// 委外出库单列表 /// /// [Route("Kf_EntrustOutBill/GetEntrustOutBill")] [HttpGet] public object GetEntrustOutBill(string sWhere) { try { ds = Sc_GetEntrustOutBill(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetEntrustOutBill(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Kf_EntrustOutBillList ", "h_v_Kf_EntrustOutBillList"); } #endregion /// /// 采购入库单列表 /// /// [Route("Kf_POStockInBill/GetPOStockInBill")] [HttpGet] public object GetPOStockInBill(string sWhere) { try { ds = Sc_GetPOStockInBill(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetPOStockInBill(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POStockInBillList ", "h_v_IF_POStockInBillList"); } #endregion /// /// 产品入库单列表 /// /// [Route("Kf_ProductInBill/GetProductInBill")] [HttpGet] public object GetProductInBill(string sWhere) { try { ds = Sc_GetProductInBill(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetProductInBill(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_ProductInBillList ", "h_v_IF_ProductInBillList"); } #endregion /// /// 其他入库单列表 /// /// [Route("Kf_OtherInBill/GetOtherInBill")] [HttpGet] public object GetOtherInBill(string sWhere) { try { ds = Sc_GetOtherInBill(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetOtherInBill(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Kf_OtherInBillList ", "h_v_Kf_OtherInBillList"); } #endregion /// /// 委外入库单列表 /// /// [Route("Kf_EntrustInBill/GetEntrustInBill")] [HttpGet] public object GetEntrustInBill(string sWhere) { try { ds = Sc_GetEntrustInBill(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #region sql语句 public static DataSet Sc_GetEntrustInBill(string sWhere) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Kf_EntrustInBillList ", "h_v_Kf_EntrustInBillList"); } #endregion //测试专用接口 [Route("LookingFor/Test")] [HttpGet] public object Test(string HbillNo)//Sc_CheckToolsRepair/GetCheckToolsRepairWorkBillList { DataSet ds; ds = new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP"); if (Pub_Class.ClsPub.isLong(ds.Tables[0].Rows.Count) >= 0) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "true!"; objJsonResult.data = ds.Tables[0];//ds.Tables[0].Rows[1][0] return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "false!"; objJsonResult.data = null; return objJsonResult; } } #endregion #region 模具维修单保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sb_MouldRepairWorkBill/SaveGetMouldRepairWorkBillList")] [HttpPost] public object SaveGetMouldRepairWorkBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSb_MouldRepairWorkBill oBill = new DAL.ClsSb_MouldRepairWorkBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldRepairWorkBillMain(msg2); foreach (Model.ClsSb_MouldRepairWorkBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3807"; oItem.HBillSubType = "3807"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HRepairBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修开始日期 //oItem.HRepairEndDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --维修结束日期 //oItem.HRepairContent = ""; //维修内容 //oItem.HCycleUnit = ""; //时间单位(小时,天) //oItem.HPlanTimes = 0; //计划维修工时 //oItem.HTimes = 0; //实际维修工时 //oItem.HEmpID = 0; //维修人(Gy_Employee) //oItem.HManagerID = 0; //主管(Gy_Employee) //oItem.HDeptID = 0; //维修部门(Gy_Department) //oItem.HExplanation = ""; //--维修要求 //oItem.HInnerBillNo = ""; // --内部单据号 //oItem.HMouldID = 0; //成品模具ID //oItem.HSupID = 0; //--供应商(Gy_Supplier) //oItem.HRepairType = ""; //--维修类型(内部维修,委外维修) addnew //oItem.HNewModel = ""; //维修后新规格 //oItem.HNewDesignLife = 0; //新设计寿命 //oItem.HRepairID = 0; //维修项目(Gy_Repair) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldRepairWorkBillSub(msg3); int i = 0; foreach (Model.ClsSb_MouldRepairWorkBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具维修列表编辑时获取表头数据] [Route("Sb_MouldRepairWorkBill/Sb_MouldRepairWorkBillListCheckDetai")] [HttpGet] public ApiResult Sb_MouldRepairWorkBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairWorkBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldRepairWorkBillList_Edit"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在维修单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具维修列表编辑时获取表体数据] [Route("Sb_MouldRepairWorkBill/Sb_MouldRepairWorkBillListProjectDetai")] [HttpGet] public object Sb_MouldRepairWorkBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); ds = oCN.RunProcReturn("select HRepairID, 子维修项目代码 HRepairCode,子维修项目 HRepairName,子维修要求 HRepairExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,维修费用 HMoney,表体备注 HRemark from h_v_Sc_MouldRepairWorkBillList_Edit", "h_v_Sc_MouldRepairWorkBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; string sql1 = "select HRepairID,子维修项目代码 HRepairCode,子维修项目 HRepairName,子维修要求 HRepairExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,维修费用 HMoney,表体备注 HRemark from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具维修单删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sb_MouldRepairWorkBill/DeltetMouldRepairWorkBill")] [HttpGet] public object DeltetMouldRepairWorkBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSb_MouldRepairWorkBill oBill = new DAL.ClsSb_MouldRepairWorkBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #region [模具维修单审核、反审核] /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sb_MouldRepairWorkBill/AuditProcessReportList")] [HttpGet] public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "Sb_MouldRepairWorkBill_Check"; DBUtility.ClsPub.CurUserName=CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID小于0!"; objJsonResult.data = null; return objJsonResult; } Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); DAL.ClsSb_MouldRepairWorkBill oBill = new DAL.ClsSb_MouldRepairWorkBill(); //查看是否已审核,关闭,作废 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //审核提交 { //审核提交 if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核提交AbandonCheck if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 模具维修验收单保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sc_MouldRepairCheckBill/SaveGetMouldRepairCheckBillList")] [HttpPost] public object SaveGetMouldRepairCheckBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string msg4 = sArray[2].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldRepairCheckBill oBill = new DLL.ClsSc_MouldRepairCheckBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldRepairCheckBillMain(msg2); foreach (Model.ClsSc_MouldRepairCheckBillMain oItem in lsmain) { oItem.HMaker = msg4; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3817"; oItem.HBillSubType = "3817"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldRepairCheckBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldRepairCheckBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具维修验收单编辑时获取表头数据] [Route("Sc_MouldRepairCheckBill/Sb_MouldRepairCheckBillListCheckDetai")] [HttpGet] public ApiResult Sb_MouldRepairCheckBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairCheckBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldRepairCheckBillList_Edit"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在维修单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具维修验收单编辑时获取表体数据] [Route("Sc_MouldRepairCheckBill/Sb_MouldRepairCheckBillListProjectDetai")] [HttpGet] public object Sb_MouldRepairCheckBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); ds = oCN.RunProcReturn("select HRepairCheckID,验收项目代码 HRepairCheckCode,验收项目 HRepairCheckName,验收内容 HRepairCheckContent,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = "select HRepairCheckID,验收项目代码 HRepairCheckCode,验收项目 HRepairCheckName,验收内容 HRepairCheckContent,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具维修验收单删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldRepairCheckBill/DeltetMouldRepairCheckBill")] [HttpGet] public object DeltetMouldRepairCheckBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairCheckBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldRepairCheckBill oBill = new DAL.ClsSc_MouldRepairCheckBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #region 模具故障登记表 #region 模具故障登记表保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sc_MouldConkBookBill/SaveGetMouldConkBookBillList")] [HttpPost] public object SaveGetMouldConkBookBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSc_MouldConkBookBill oBill = new DAL.ClsSc_MouldConkBookBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldConkBookBillMain(msg2); foreach (Model.ClsSc_MouldConkBookBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 DBUtility.ClsPub.CurUserName = UserName; oItem.HBillType = "3815"; oItem.HBillSubType = "3815"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldConkBookBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldConkBookBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具故障登记表编辑时获取表头数据] [Route("Sc_MouldConkBookBill/Sb_MouldConkBookBillListCheckDetai")] [HttpGet] public ApiResult Sb_MouldConkBookBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldConkBookBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldConkBookBillList_Edit"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在维修单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具故障登记表编辑时获取表体数据] [Route("Sc_MouldConkBookBill/Sb_MouldConkBookBillListProjectDetai")] [HttpGet] public object Sb_MouldConkBookBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); ds = oCN.RunProcReturn("select HConkReasonID,故障原因代码 HConkReasonCode,故障原因 HConkReasonName,故障原因描述 HConkExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldConkBookBillList_Edit", "h_v_Sc_MouldConkBookBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = "select HConkReasonID,故障原因代码 HConkReasonCode,故障原因 HConkReasonName,故障原因描述 HConkExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldConkBookBillList_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldConkBookBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具故障登记表删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldConkBookBill/DeltetMouldConkBookBill")] [HttpGet] public object DeltetMouldConkBookBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldConkBookBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldConkBookBill oBill = new DAL.ClsSc_MouldConkBookBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具保养计划单 #region 模具保养计划单 保存/编辑 /// /// 保存模具保养计划单 /// /// /// [Route("Sc_MouldMaintainPlanBill/SaveGetMouldMaintainPlanBillList")] [HttpPost] public object SaveGetMouldMaintainPlanBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillMain(msg2); foreach (Model.ClsSc_MouldMaintainPlanBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3818"; oItem.HBillSubType = "3818"; //oItem.HInterID =0; //oItem.HBillNo = ""; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); //oItem.HMakeDate = ""; //oItem.HYear = ""; //oItem.HPeriod = ""; //oItem.HRemark = ""; //oItem.HCycleUnit = ""; //oItem.HCheckCycle = ""; //oItem.HBeginDate = ""; //oItem.HEndDate = ""; //oItem.HInnerBillNo = ""; //oItem.HExplanation = ""; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldMaintainPlanBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //HMaterID = "";//配件代码 //HUnitID = "";//单位代码 //HQty = "";//实际用量 //HQtyMust = "";//单位用量 //HRemark = "";//备注 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具保养计划单编辑时获取表头数据] [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldMaintainPlanBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldMaintainPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldMaintainPlanBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在保养计划单" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具保养计划单编辑时获取表题数据] [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListProjectDetai")] [HttpGet] public object Sc_MouldMaintainPlanBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn("select HMaterID,HUnitID,HQty,HQtyMust,HRemark from Sc_MouldMaintainPlanBillSub", "Sc_MouldMaintainPlanBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { string sql1 = "select HMaterID,HUnitID,HQty,HQtyMust,HRemark from Sc_MouldMaintainPlanBillSub where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainPlanBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具保养计划单删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldMaintainPlanBill/DeltetMouldMaintainPlanBill")] [HttpGet] public object DeltetMouldMaintainPlanBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具保养记录表 #region 模具保养记录表 保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sc_MouldMaintainBill/SaveGetMouldMaintainBillList")] [HttpPost] public object SaveGetMouldMaintainBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string msg4 = sArray[2].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2); foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) { UserName = oItem.HMaker; //制单人 DBUtility.ClsPub.CurUserName = UserName; oItem.HBillType = "3819"; oItem.HBillSubType = "3819"; //oItem.HInterID =0; //oItem.HBillNo = ""; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); //oItem.HMakeDate = ""; //oItem.HYear = ""; //oItem.HPeriod = ""; //oItem.HRemark = ""; //oItem.HCycleUnit = ""; //oItem.HCheckCycle = ""; //oItem.HBeginDate = ""; //oItem.HEndDate = ""; //oItem.HInnerBillNo = ""; //oItem.HExplanation = ""; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //保养项表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Sc_MouldMaintainRuleBillSub_Item(msg3); int i = 0; foreach (Model.ClsSc_MouldMaintainRuleBillSub_Item oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 oItemSub.HRelationQty = 0; //关联数量 oBill.DetailCol.Add(oItemSub); } //配件项表体数据 //按 },{来拆分数组 //去掉【和】 msg4 = msg4.Substring(1, msg4.Length - 2); msg4 = msg4.Replace("\\", ""); msg4 = msg4.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls1 = new List(); ls1 = oListModels.getObjectByJson_Sc_MouldMaintainBillSub(msg4); int j = 0; foreach (Model.ClsSc_MouldMaintainBillSub Sub in ls1) { j++; Sub.HEntryID = j; //oItemSub.HCloseMan = ""; //行关闭 Sub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); Sub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 Sub.HSourceInterID = 0; // 源单主内码 Sub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 Sub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //HMaterID = "";//配件代码 //HUnitID = "";//单位代码 //HQty = "";//实际用量 //HQtyMust = "";//单位用量 //HRemark = "";//备注 oBill.DetailColl.Add(Sub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具保养记录表编辑时获取表头数据] [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldMaintainBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldMaintain where hmainid= " + HID + " ", "h_v_Sc_MouldMaintain"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在保养记录表" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具保养记录表编辑时获取表题数据] [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListProjectDetai")] [HttpGet] public object Sc_MouldMaintainBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn("select HMaterID,HUnitID,HQty,HQtyMust,HRemark,HManagerID from Sc_MouldMaintainBillSub", "Sc_MouldMaintainBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { string sql1 = "select HMaterID,HUnitID,HQty,HQtyMust,HRemark,HManagerID from Sc_MouldMaintainBillSub where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region[模具保养记录表编辑时获取表体数据新(保养项列表、配件项列表)] [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListProjectDetaiNew")] [HttpGet] public object Sc_MouldMaintainBillListProjectDetaiNew(string HInterID) { DataSet ds,ds1; List list = new List(); string Swhere = ""; try { if (HInterID != "" || HInterID != null) { Swhere = " and hmainid='" + HInterID + "'"; } else { Swhere = HInterID; } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //获取保养项目编辑数据 string sql = "select HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目名称 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark from h_v_Sc_MouldMaintainBillListItem where 1 = 1 " + Swhere + ""; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainBillListItem"); //获取配件项目编辑数据 string sql1 = "select HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,规格型号 HMaterSpec,HUnitID,单位代码 HUnitNumber,单位名称 HUnitName,实际用量 HQty,标准用量 HQtyMust,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark from h_v_Sc_MouldMaintainBillList where 1 = 1 " + Swhere + ""; ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainBillList"); list.Add(ds.Tables[0]); list.Add(ds1.Tables[0]); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.list = list; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具保养记录表删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldMaintainBill/DeltetSc_MouldMaintainBill")] [HttpGet] public object DeltetSc_MouldMaintainBill(string HInterID) { Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具点检记录表 #region 模具点检记录表 保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sc_MouldDotCheckBill/SaveGetMouldDotCheckBillList")] [HttpPost] public object SaveGetMouldDotCheckBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckBillMain(msg2); foreach (Model.ClsSc_MouldDotCheckBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3821"; oItem.HBillSubType = "3821"; //oItem.HInterID =0; //oItem.HBillNo = ""; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); //oItem.HMakeDate = ""; //oItem.HYear = ""; //oItem.HPeriod = ""; //oItem.HRemark = ""; //oItem.HCycleUnit = ""; //oItem.HCheckCycle = ""; //oItem.HBeginDate = ""; //oItem.HEndDate = ""; //oItem.HInnerBillNo = ""; //oItem.HExplanation = ""; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Sc_MouldDotCheckBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldDotCheckBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //HMaterID = "";//配件代码 //HUnitID = "";//单位代码 //HQty = "";//实际用量 //HQtyMust = "";//单位用量 //HRemark = "";//备注 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具点检记录表编辑时获取表头数据] [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldDotCheckBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在点检记录表" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具点检记录表编辑时获取表题数据] [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListProjectDetai")] [HttpGet] public object Sc_MouldDotCheckBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn("select 点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName from h_v_Sc_MouldDotCheckBillList", "h_v_Sc_MouldDotCheckBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { string sql1 = "select 点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName from h_v_Sc_MouldDotCheckBillList where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具点检记录表删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldDotCheckBill/DeltetSc_MouldDotCheckBill")] [HttpGet] public object DeltetSc_MouldDotCheckBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具点检计划表 #region 模具点检计划表 保存/编辑 /// /// 保存模具维修单 /// /// /// [Route("Sc_MouldDotCheckPlanBill/SaveGetMouldDotCheckPlanBillList")] [HttpPost] public object SaveGetMouldDotCheckPlanBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DAL.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillMain(msg2); foreach (Model.ClsSc_MouldDotCheckPlanBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3821"; oItem.HBillSubType = "3821"; //oItem.HInterID =0; //oItem.HBillNo = ""; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); //oItem.HMakeDate = ""; //oItem.HYear = ""; //oItem.HPeriod = ""; //oItem.HRemark = ""; //oItem.HCycleUnit = ""; //oItem.HCheckCycle = ""; //oItem.HBeginDate = ""; //oItem.HEndDate = ""; //oItem.HInnerBillNo = ""; //oItem.HExplanation = ""; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldDotCheckPlanBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //HMaterID = "";//配件代码 //HUnitID = "";//单位代码 //HQty = "";//实际用量 //HQtyMust = "";//单位用量 //HRemark = "";//备注 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region[模具点检计划表编辑时获取表头数据] [Route("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldDotCheckPlanBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckPlanBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在点检计划表" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具点检计划表编辑时获取表题数据] [Route("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBillListProjectDetai")] [HttpGet] public object Sc_MouldDotCheckPlanBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn("select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub", "Sc_MouldDotCheckPlanBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { string sql1 = "select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckPlanBillSub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何计划!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region [模具点检计划表删除功能] /// /// 模具维修单删除功能 /// /// [Route("Sc_MouldDotCheckPlanBill/DeltetSc_MouldDotCheckPlanBillBill")] [HttpGet] public object DeltetSc_MouldDotCheckPlanBillBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具报废入库单 #region[模具报废入库单编辑时获取表头数据] [Route("Sc_MouldScrapInHouseBill/Sc_MouldScrapInHouseBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldScrapInHouseBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldScrapInHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldScrapInHouseBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在维修单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具报废入库单编辑时获取表体数据] [Route("Sc_MouldScrapInHouseBill/Sc_MouldScrapInHouseBillListProjectDetai")] [HttpGet] public object Sc_MouldScrapInHouseBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName, HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark FROM h_v_Sc_MouldScrapInHouseBillList"), "h_v_Sc_MouldScrapInHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName, HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark FROM h_v_Sc_MouldScrapInHouseBillList where 1 = 1 "); string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldScrapInHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region 模具报废入库单保存/编辑 /// /// 保存模具报废入库单 /// /// /// [Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList")] [HttpPost] public object SaveGetMouldScrapInHouseBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string refSav = sArray[2].ToString(); string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (BillOld0.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3831"; oItem.HBillSubType = "3831"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); int i = 0; foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 模具报废入库单保存 [Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList_PDA")] [HttpPost] public object SaveGetMouldScrapInHouseBillList_PDA([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) { //单据号是否重复 if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3831"; oItem.HBillSubType = "3831"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //子表体数据 List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg2); int i = 0; foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #endregion #region 模具处理出库单 #region 模具处理出库单列表 [Route("Sc_MouldScrapOutHouseBill/GetMouldScrapOutHouseBill")] [HttpGet] public object GetMouldScrapOutHouseBill(string sWhere) { try { ds = Sc_GetMouldScrapOutHouseBill(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } public static DataSet Sc_GetMouldScrapOutHouseBill(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldScrapOutHouseBillList order by 日期 desc", "h_v_Sc_MouldScrapOutHouseBillList"); } else { string sql1 = "select * from h_v_Sc_MouldScrapOutHouseBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldScrapOutHouseBillList"); } } #endregion #region[模具处理出库单编辑时获取表头数据] [Route("Sc_MouldScrapOutHouseBill/Sc_MouldScrapOutHouseBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldScrapOutHouseBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldScrapOutHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldScrapOutHouseBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在维修单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具处理出库单编辑时获取表体数据] [Route("Sc_MouldScrapOutHouseBill/Sc_MouldScrapOutHouseBillListProjectDetai")] [HttpGet] public object Sc_MouldScrapOutHouseBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, 换算率 HSecUnitRate, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实发数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 发货仓库代码 HWHCode, 发货仓库名称 HWHName, HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark FROM h_v_Sc_MouldScrapOutHouseBillList"), "h_v_Sc_MouldScrapOutHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, 换算率 HSecUnitRate, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实发数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 发货仓库代码 HWHCode, 发货仓库名称 HWHName, HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark FROM h_v_Sc_MouldScrapOutHouseBillList where 1 = 1 "); string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldScrapOutHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region 模具处理出库单保存/编辑 /// /// 保存模具处理出库单 /// /// /// [Route("Sc_MouldScrapOutHouseBill/SaveGetMouldScrapOutHouseBillList")] [HttpPost] public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3832"; oItem.HBillSubType = "3832"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region [模具处理出库单删除功能] /// /// 模具处理出库库单删除功能 /// /// [Route("Sc_MouldScrapOutHouseBill/DeltetMouldScrapOutHouseBill")] [HttpGet] public object DeltetMouldScrapOutHouseBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DAL.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #region [模具处理出库单审核、反审核] /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MouldScrapOutHouseBill/AuditMouldScrapOutList")] [HttpGet] public object AuditMouldScrapOutList(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "Sc_MouldScrapOutBill_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID <= 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID小于0!"; objJsonResult.data = null; return objJsonResult; } Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); //查看是否已审核,关闭,作废 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //审核提交 { //审核提交 if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核提交AbandonCheck if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具退库单 #region 模具退库单列表 [Route("Sc_MouldProdBackBill/GetMouldProdBackBill")] [HttpGet] public object GetMouldProdBackBill(string sWhere) { try { ds = Sc_GetMouldProdBackBill(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } public static DataSet Sc_GetMouldProdBackBill(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldProdBackBillList order by 日期 desc ", "h_v_Sc_MouldProdBackBillList"); } else { string sql1 = "select * from h_v_Sc_MouldProdBackBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList"); } } #endregion #region[模具退库单编辑时获取表头数据] [Route("Sc_MouldProdBackBill/Sc_MouldProdBackBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldProdBackBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdBackBillList where hmainid= " + HID + " ", "h_v_Sc_MouldProdBackBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在退库单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具退库单编辑时获取表体数据] [Route("Sc_MouldProdBackBill/Sc_MouldProdBackBillListProjectDetai")] [HttpGet] public object Sc_MouldProdBackBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark FROM h_v_Sc_MouldProdBackBillList where 1 = 1 "); string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region 模具退库单保存/编辑 /// /// 保存模具退库单 /// /// /// [Route("Sc_MouldProdBackBill/SaveGetMouldProdBackBillList")] [HttpPost] public object SaveGetMouldProdBackBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3803"; oItem.HBillSubType = "3803"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region [模具处理退库单删除功能] /// /// 模具处理退库单删除功能 /// /// [Route("Sc_MouldProdBackBill/DeltetMouldProdBackBill")] [HttpGet] public object DeltetMouldProdBackBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具领用单 #region 模具领用单列表 [Route("Sc_MouldProdOutBill/GetMouldProdOutBill")] [HttpGet] public object GetMouldProdOutBill(string sWhere) { try { ds = Sc_GetMouldProdOutBill(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } public static DataSet Sc_GetMouldProdOutBill(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldProdOutHouseBillList order by 日期 desc", "h_v_Sc_MouldProdOutHouseBillList"); } else { string sql1 = "select * from h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); } } #endregion #region[模具领用单编辑时获取表头数据] [Route("Sc_MouldProdOutBill/Sc_MouldProdOutBillListCheckDetai")] [HttpGet] public ApiResult Sc_MouldProdOutBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdOutHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldProdOutHouseBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在退库单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具领用单编辑时获取表体数据] [Route("Sc_MouldProdOutBill/Sc_MouldProdOutBillListProjectDetai")] [HttpGet] public object Sc_MouldProdOutBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark FROM h_v_Sc_MouldProdOutHouseBillList"), "h_v_Sc_MouldProdOutHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark FROM h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "); string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region 模具领用单保存/编辑 /// /// 保存模具领用单 /// /// /// [Route("Sc_MouldProdOutBill/SaveGetMouldProdOutBillList")] [HttpPost] public object SaveGetMouldProdOutBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3802"; oItem.HBillSubType = "3802"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region [模具处理领用单删除功能] /// /// 模具处理领用单删除功能 /// /// [Route("Sc_MouldProdOutBill/DeltetMouldProdOutBill")] [HttpGet] public object DeltetMouldProdOutBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 模具寿命调整单 #region 模具寿命调整表 [Route("Sc_MouldLifeChangeBill/GetMouldLifeChangeBill")] [HttpGet] public object GetMouldLifeChangeBill(string sWhere) { try { ds = Sc_GetMouldLifeChangeBill(sWhere); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } public static DataSet Sc_GetMouldLifeChangeBill(string sWhere) { if (sWhere == null || sWhere.Equals("")) { return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldLifeChangeBillList order by 日期 desc", "h_v_Sc_MouldLifeChangeBillList"); } else { string sql1 = "select * from h_v_Sc_MouldLifeChangeBillList where 1 = 1 "; string sql = sql1 + sWhere+ "order by 日期 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList"); } } #endregion #region[模具寿命调整单编辑时获取表头数据] [Route("Sc_MouldLifeChangeBill/Sc_GetMouldLifeChangeBillListCheckDetai")] [HttpGet] public ApiResult Sc_Sc_GetMouldLifeChangeBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldLifeChangeBillList where hmainid= " + HID + " ", "h_v_Sc_MouldLifeChangeBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在退库单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[模具寿命调整单编辑时获取表体数据] [Route("Sc_MouldLifeChangeBill/Sc_MouldLifeChangeBillListProjectDetai")] [HttpGet] public object Sc_MouldLifeChangeBillListProjectDetai(string sqlWhere) { DataSet ds; try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate, HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName, 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } else { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName, HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate, HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName, 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 "); string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "获取信息成功!"; objJsonResult.data = ds.Tables[0]; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; } return objJsonResult; } #endregion #region 模具寿命调整单保存/编辑 /// /// 保存模具领用单 /// /// /// [Route("Sc_MouldLifeChangeBill/SaveGetMouldLifeChangeBillList")] [HttpPost] public object SaveGetMouldLifeChangeBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); try { DLL.ClsSc_MouldLifeChangeBill oBill = new DLL.ClsSc_MouldLifeChangeBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldLifeChangeBillMain(msg2); foreach (Model.ClsSc_MouldLifeChangeBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //制单人 oItem.HBillType = "3824"; oItem.HBillSubType = "3824"; //oItem.HBillNo = ""; //单据号 //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 //oItem.HInnerBillNo = ""; // --内部单据号 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) //oItem.HPeriod = 0; //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 //oItem.HCheckResult = ""; //验收结论--(正常,异常) //oItem.HEmpID = 0; //验收人(Gy_Employee) //oItem.HManagerID = 0; //负责人(Gy_Employee) //oItem.HDeptID = 0; //验收部门(Gy_Department) //oItem.HExplanation = ""; //摘要(故障描述) //oItem.HRemark = ""; //备注 //oItem.HMainSourceInterID = oItem.HInterID; //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "’"); List ls = new List(); ls = oListModels.getObjectByJson_Gy_MouldLifeChangeBillSub(msg3); int i = 0; foreach (Model.ClsSc_MouldLifeChangeBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; //oItemSub.HRepairCheckID = 0; //验收项目ID //oItemSub.HRepairCheckContent = ""; //验收内容 //oItemSub.HManagerID = 0; //负责人ID //oItemSub.HCloseMan = ""; //行关闭 oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 //oItemSub.HRemark = ""; //备注 oItemSub.HSourceInterID = 0; // 源单主内码 oItemSub.HSourceEntryID = 0; //源单子内码 //oItemSub.HSourceBillNo = ""; //源单单号 //oItemSub.HSourceBillType = ""; //源单类型 //oItemSub.HRelationQty = 0; //关联数量 //oItemSub.HRelationMoney = 0; //关联金额 //oItemSub.HRepairID = 0; //维修项目 //oItemSub.HRepairExplanation =""; //维修要求 //oItemSub.HMoney = 0; //维修费用 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (oBill.omodel.HInterID == 0) { // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "保存成功!"; //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region [模具寿命调整单删除功能] /// /// 模具处理领用单删除功能 /// /// [Route("Sc_MouldLifeChangeBill/DeltetMouldLifeChangeBill")] [HttpGet] public object DeltetMouldLifeChangeBill(string HInterID) { //编辑权限 //if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeChangeBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无删除权限!"; // objJsonResult.data = null; // return objJsonResult; //} Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DLL.ClsSc_MouldLifeChangeBill oBill = new DLL.ClsSc_MouldLifeChangeBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未找到"; objJsonResult.data = null; return objJsonResult; } } #endregion #endregion } }